package com.foxmail.aroundme.youtubedemo.fmgIntoListView;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.foxmail.aroundme.youtubedemo.R;
import com.foxmail.aroundme.youtubedemo.listview.ListViewAdapter;
import com.foxmail.aroundme.youtubedemo.utils.RandomId;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created by gzl on 2016/10/25.
 */

public class FrgmemtIntoListView extends Fragment {
    private List<String> list = new ArrayList<String>();
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        Random random = new Random();
        for(int i = 0 ; i < 100; i ++){
            list.add(RandomId.args[random.nextInt(100)]);
        }
        View view = inflater.inflate(R.layout.into_listview, container, false);
        ListView listView = (ListView) view.findViewById(R.id.listview_frag);
        listView.setAdapter(new ListViewAdapter(getActivity(), list, getFragmentManager()));

        return view;
    }
}
